<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

<!--    <div class="form-group">-->
<!--        <label class="control-label col-xs-12 col-sm-2">{:__('Uid')}:</label>-->
<!--        <div class="col-xs-12 col-sm-8">-->
<!--            <input id="c-uid" class="form-control" name="row[uid]" type="number">-->
<!--        </div>-->
<!--    </div>-->
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">卡种:</label>
        <div class="col-xs-12 col-sm-8">


            <select id="c-c_id" class="form-control" v-model="sex" name="row[c_id]">
                {foreach name="card" item="vo"}
                     <option value="{$vo.id}">{$vo.cardname}</option>
                {/foreach}
            </select>


        </div>
    </div>


<!--    <div class="form-group">-->
<!--        <label class="control-label col-xs-12 col-sm-2">{:__('D_number')}:</label>-->
<!--        <div class="col-xs-12 col-sm-8">-->
<!--            <input id="c-d_number" class="form-control" name="row[d_number]" type="text">-->
<!--        </div>-->
<!--    </div>-->

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">生成兑换码个数:</label>
        <div class="col-xs-12 col-sm-8">
<!--            <input id="nnum" class="form-control"  type="number" style="float: left;width: 60%">-->
<!--            <div type="submit" class="btn btn-success btn-embossed" style="float: right" onclick="add()">创建兑换码</div>-->

            <input id="nnum" name="row[nnum]" class="form-control"  type="number" style="">


        </div>
    </div>


<!--    <div class="form-group">-->
<!--        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>-->
<!--        <div class="col-xs-12 col-sm-8">-->

<!--            <div class="radio">-->
<!--            {foreach name="statusList" item="vo"}-->
<!--            <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="0"}checked{/in} /> {$vo}</label>-->
<!--            {/foreach}-->
<!--            </div>-->

<!--        </div>-->
<!--    </div>-->
<!--    <div class="form-group">-->
<!--        <label class="control-label col-xs-12 col-sm-2">{:__('D_time')}:</label>-->
<!--        <div class="col-xs-12 col-sm-8">-->
<!--            <input id="c-d_time"  class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[d_time]" type="text" value="{:date('Y-m-d H:i:s')}">-->
<!--        </div>-->



    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('C_time')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-c_time" readonly="true" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[c_time]" type="text" value="{:date('Y-m-d H:i:s')}">
        </div>
    </div>
<!--    <div class="form-group">-->
<!--        <label class="control-label col-xs-12 col-sm-2">{:__('Less_hours')}:</label>-->
<!--        <div class="col-xs-12 col-sm-8">-->
<!--            <input id="c-less_hours" class="form-control" name="row[less_hours]" type="number">-->
<!--        </div>-->
<!--    </div>-->
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>
　<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script>
    function  add() {
        var num = $("#nnum").val()
        if(!num){
            alert ('请输入兑换数量')
            return false
        }else{
            $.ajax({
                url: "auth/group/roletree",
                type: 'post',
                dataType: 'json',
                data: {id: id, pid: $(this).val()},
                success: function (ret) {
                    if (ret.hasOwnProperty("code")) {
                        var data = ret.hasOwnProperty("data") && ret.data != "" ? ret.data : "";
                        if (ret.code === 1) {
                            //销毁已有的节点树
                            $("#treeview").jstree("destroy");
                            Controller.api.rendertree(data);
                        } else {
                            Backend.api.toastr.error(ret.msg);
                        }
                    }
                }, error: function (e) {
                    Backend.api.toastr.error(e.message);
                }
            });

        }
    }
    </script>
